package com.ftdigital.primemovers_operators.config;


import com.ftdigital.primemovers_operators.util.MD5;

/**
 * Created by puman on 15/7/21.
 */
public class RequestAddr {


    //访问服务器地址
//    private static String baseUrl = "http://122.226.199.116:9696/beautyfarm/";//测试
//    private static String Ip = "http://122.226.199.116/";
//    private static String Ip = "http://115.159.6.217/";
    private static String Ip = "http://139.196.190.42/";
//    private static String Ip = "http://qyh.puman.cn/";
    private static String baseUrl = Ip + "youin/staff/";//生产
    public static String imageUrl = Ip + "youins/image/";  //图片地址
    public static String webUrl = Ip + "youin/index.jsp";//网页地址


    // 加密字符串
    private static String timeStamp = "";
    private static String safeStr = "public_key=bf_mob_app&timestamp=" + timeStamp + "&sign=" + getSign() + "&";
    private static String secret_key;//私钥
    private static String public_key;//公钥


    public static String login = getUrl("home/login");  //登录

    public static String addoilInfo = getUrl("home/carDetail");//无手机验证并获取订单信息
    public static String addOilList = getUrl("gas/gasList");//加油历史列表  已完成
    public static String addOilUnfinishList = getUrl("gas/gasListUnfinish");//加油历史列表  未完成
    //    public static String noMobileAddList = getUrl("home/createOrderByPWD");//无手机添加订单
    public static String creatOrder = getUrl("home/createOrder");//添加订单
    public static String modifyOrder = getUrl("home/modifyOrder");//修改订单
    public static String doneOrder = getUrl("home/finishOrder");//完成订单
    public static String checkBlace = getUrl("home/validateBalance");//检查余额是否充足

    public static String oilReprotList = getUrl("mine/report");//油量报表
    public static String dayInventory = getUrl("mine/stockList");//每日库存
    public static String teamHistory = getUrl("home/carGasList");//车队历史
    public static String addDayInventory = getUrl("mine/addStock");//增加每日库存
    public static String orderDeatail = getUrl("gas/orderDeatail");//正在进行的交易详情
    public static String addEvaluation = getUrl("gas/addEvaluation");//添加评价
    public static String gasDeatail = getUrl("gas/gasDeatail");//加油列表详情
    public static String gasListSearch = getUrl("gas/gasListSearch");//加油历史搜索

    public static String uploadUserInfo = getUrl("minefile/editMine");//个人信息修改
    public static String uploadUserInfoNoPic = getUrl("minefile/editMineBasic");//个人信息修改  未修改头像
    /**
     * 获取加密签名
     *
     * @return 加密后的签名
     */
    private static String getSign() {
        return MD5.getMD5ofStr("qzed_suj4+hzudl9zrqw9q" + "&"
                + "youin_app" + "&" + timeStamp);
    }


    /**
     * @return 从1970年1月1日至今的秒数
     */
    private static Long getTimestamp() {
        return System.currentTimeMillis();
    }

    /**
     * 拼接Url
     *
     * @param relativeUrl 相对地址
     * @return
     */
    private static String getUrl(String relativeUrl) {
        timeStamp = getTimestamp().toString();
        return baseUrl + relativeUrl + "?" + "public_key=youin_app&timestamp=" + timeStamp + "&sign=" + getSign() + "&";
    }
}
